Mostly Harmless

Legacy:Vehicles Pre2004/Exiting

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Exiting while SubMerged[edit]

When you drive/fly/float your vehicle under water, and you get out, you can't move anymore, this is because your Physics is set to Falling, but it has to be Swimming. This can be fixed easy:

function bool KDriverLeave(bool bForceLeave)
{
	local Pawn OldDriver;
 
	OldDriver = Driver;
 
	// If we successfully got out of the car, make driver visible again. And check if in water.
	if( Super.KDriverLeave(bForceLeave) )
	{
		OldDriver.bHidden = false; //Also seen in the bulldog, so can't be bad :)
		//If we are in water, set the physics to swimming
		if (OldDriver.TouchingWaterVolume())
		{
			OldDriver.SetPhysics(PHYS_Swimming);
		}
		return true;
	}
	else
		return false;
}